package com.example.client.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.cloud.netflix.eureka.EurekaDiscoveryClient;
import org.springframework.web.bind.annotation.*;

/**
 * @auth leihtg
 * @date 2018/11/27 11:53
 */
@RestController
    @RequestMapping("provider")
public class ProviderController {

    @Autowired
    DiscoveryClient discoveryClient;

    @GetMapping("queryInfo")
    public String dc() {
        String ins = discoveryClient.description();

        String services = "Services: " +ins;
        System.out.println("services = " + services);
        return services;
    }

    @RequestMapping("hello/{name}")
    public String welcome(@PathVariable("name") String name) {
        return "wellcome to china : " + name;
    }
}
